<!DOCTYPE html>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta name="description" content="JinYan&#39;s blog">
  <meta name="keyword" content="hexo-theme, vuejs">
  
    <link rel="shortcut icon" href="/blog/css/images/logo.jpg">
  
  <title>
    
      Linux-常用命令 | SanYuanEmpire
    
  </title>
  <link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="//cdn.bootcss.com/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
  <link href="//cdn.bootcss.com/highlight.js/9.12.0/styles/tomorrow.min.css" rel="stylesheet">
  <link rel="stylesheet" href="/blog/css/style.css">
<link rel="stylesheet" href="/blog/css/plugins/gitment.css">
  <script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script src="//cdn.bootcss.com/geopattern/1.2.3/js/geopattern.min.js"></script>
  <script src="//cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js"></script>
  <script src="/blog/js/qrious.js"></script>
<script src="/blog/js/gitment.js"></script>
  
  
    <!-- MathJax support START -->
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <!-- MathJax support END -->
  


</head>
<div class="wechat-share">
  <img src="/css/images/logo.jpg" />
</div>

  <body>
    <header class="header fixed-header">
  <div class="header-container">
    <a class="home-link" href="/blog/">
      <div class="logo"></div>
      <span>SanYuanEmpire</span>
    </a>
    <ul class="right-list">
      
        <li class="list-item">
          
            <a href="/blog/" class="item-link">Home</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/blog/archives/" class="item-link">Archives</a>
          
        </li>
      
    </ul>
    <div class="menu">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </div>
    <div class="menu-mask">
      <ul class="menu-list">
        
          <li class="menu-item">
            
              <a href="/blog/" class="menu-link">Home</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/blog/archives/" class="menu-link">Archives</a>
            
          </li>
        
      </ul>
    </div>
  </div>
</header>

    <div id="article-banner">
  <h2>Linux-常用命令</h2>
  <p class="post-date">2018-09-05</p>
  <div class="arrow-down">
    <a href="javascript:;"></a>
  </div>
</div>
<main class="app-body flex-box">
  <!-- Article START -->
  <article class="post-article">
    <section class="markdown-content"><h1 id="备份配置"><a href="#备份配置" class="headerlink" title="备份配置"></a>备份配置</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cp nginx.conf nginx.conf.$(date +%F)</span><br></pre></td></tr></table></figure>
<h1 id="静态路由"><a href="#静态路由" class="headerlink" title="静态路由"></a>静态路由</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">route add default gw 3.3.3.3</span><br><span class="line">route add -host 3.3.3.3 gw 3.3.3.1</span><br><span class="line">route del -host 3.3.3.3 gw 3.3.3.1</span><br><span class="line">traceroute -n 3.3.3.1</span><br><span class="line">vim /etc/rc.local</span><br><span class="line">route add -net 3.3.3.0 netmask 255.255.0.0 gw 3.3.3.1</span><br></pre></td></tr></table></figure>
<h1 id="php-测试页"><a href="#php-测试页" class="headerlink" title="php 测试页"></a>php 测试页</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">echo &quot;&lt;?php phpinfo(); ?&gt;&quot; &gt; test.php</span><br></pre></td></tr></table></figure>
<h1 id="排除注释行"><a href="#排除注释行" class="headerlink" title="排除注释行"></a>排除注释行</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">egrep -v &quot;#|^$&quot;</span><br></pre></td></tr></table></figure>
<h1 id="EmEditor-正则表达式去除空行"><a href="#EmEditor-正则表达式去除空行" class="headerlink" title="EmEditor 正则表达式去除空行"></a>EmEditor 正则表达式去除空行</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">^[\s\t]*\n</span><br></pre></td></tr></table></figure>
<h1 id="查看目录文件大小并按顺序排列取前十名"><a href="#查看目录文件大小并按顺序排列取前十名" class="headerlink" title="查看目录文件大小并按顺序排列取前十名"></a>查看目录文件大小并按顺序排列取前十名</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">du -sh /data/* | sort -r | head -n 10</span><br></pre></td></tr></table></figure>
<h1 id="配置免密登录"><a href="#配置免密登录" class="headerlink" title="配置免密登录"></a>配置免密登录</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t rsa -b 2048</span><br><span class="line">ssh-copy-id 3.3.3.3</span><br><span class="line">cat ~/.ssh/id_rsa.pub &gt; ~/.ssh/authorized_keys</span><br><span class="line">chmod 600 ~/.ssh/authorized_keys</span><br><span class="line">mkdir -p /root/.ssh/</span><br><span class="line">scp ~/.ssh/authorized_keys root@3.3.3.3:/root/.ssh/</span><br><span class="line">scp ~/.ssh/authorized_keys root@3.3.3.3:/root/.ssh/</span><br></pre></td></tr></table></figure>
<h1 id="在bash中检查远程端口是否打开"><a href="#在bash中检查远程端口是否打开" class="headerlink" title="在bash中检查远程端口是否打开:"></a>在bash中检查远程端口是否打开:</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">echo &gt;/dev/tcp/10.6.1.36/3389 &amp;&amp; echo &quot;open&quot;</span><br></pre></td></tr></table></figure>
<h1 id="Linux查看RAID"><a href="#Linux查看RAID" class="headerlink" title="Linux查看RAID"></a>Linux查看RAID</h1><blockquote>
<p>RAID 型号对应表信息如下：<br>RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0” # 代表Raid 1<br>RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0” # 代表Raid 0<br>RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3” # 代表Raid 5<br>RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0” # 代表Raid10</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">cat /proc/scsi/scsi</span><br><span class="line">Attached devices:</span><br><span class="line">Host: scsi0 Channel: 02 Id: 00 Lun: 00</span><br><span class="line">  Vendor: DELL Model: PERC 6/i Rev: 1.22</span><br><span class="line">  Type: Direct-Access ANSI SCSI revision: 05</span><br></pre></td></tr></table></figure>
<h1 id="Linux系统扫描硬盘坏块的方法"><a href="#Linux系统扫描硬盘坏块的方法" class="headerlink" title="Linux系统扫描硬盘坏块的方法"></a>Linux系统扫描硬盘坏块的方法</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Linux系统扫描硬盘坏块可以用badblocks这个命令，命令用法：#</span><br><span class="line">badblocks -s -b 4096 -c 16 /dev/sda -o badblocks.txt</span><br><span class="line">意思就是以4k为一个block，每一个block检查16次，将结果输入到1.txt文件，如果硬盘正常的话，1.txt是没有任何内容的，如果硬盘很大，我们可以加一个-s参数来显示进度。</span><br></pre></td></tr></table></figure>
<h1 id="Linux-查看硬件信息"><a href="#Linux-查看硬件信息" class="headerlink" title="Linux 查看硬件信息"></a>Linux 查看硬件信息</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">cat /proc/cpuinfo</span><br><span class="line">free -m</span><br><span class="line">df -h</span><br></pre></td></tr></table></figure>
<h1 id="RedHat-系列查看版本"><a href="#RedHat-系列查看版本" class="headerlink" title="RedHat 系列查看版本"></a>RedHat 系列查看版本</h1><p>cat /etc/redhat-release</p>
<h1 id="Linux-生成随机密码"><a href="#Linux-生成随机密码" class="headerlink" title="Linux 生成随机密码"></a>Linux 生成随机密码</h1><p>openssl rand -base64 8</p>
<h1 id="Linux-命令——screen"><a href="#Linux-命令——screen" class="headerlink" title="Linux 命令——screen"></a>Linux 命令——screen</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">安装完毕后，输入 screen -S sessionname 即可创建一个名为 sessionname 的 screen 会话窗口。在此窗口中执行想要做的任务，然后同时按下 ctrl a，松开后按下 d，即可将此 session 放到后台去运行，并回到之前的对话窗口。在非 screen 对话窗口中，输入 screen -ls 可以列举已有的 screen 进程。输入 &quot;screen -r 进程代码&quot; 就可以再次调出正在运行的 screen 进程。</span><br><span class="line">screen -S test</span><br><span class="line">screen -ls</span><br><span class="line">screen -r 27071</span><br></pre></td></tr></table></figure>
<h1 id="Linux-增加回收站"><a href="#Linux-增加回收站" class="headerlink" title="Linux 增加回收站"></a>Linux 增加回收站</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">git clone https://github.com/lagerspetz/linux-stuff</span><br><span class="line">mv linux-stuff/scripts/saferm.sh /bin</span><br><span class="line">vim .bashrc</span><br><span class="line">alias rm=saferm.sh</span><br><span class="line">source .bashrc</span><br><span class="line">touch 1</span><br><span class="line">rm 1</span><br><span class="line">Moving 1 to /root/Trash</span><br><span class="line">ls /root/Trash/</span><br><span class="line">1</span><br></pre></td></tr></table></figure>
<h1 id="Linux-安装开发工具包"><a href="#Linux-安装开发工具包" class="headerlink" title="Linux 安装开发工具包"></a>Linux 安装开发工具包</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum groupinstall &quot;Development tools&quot; -y</span><br></pre></td></tr></table></figure>
<h1 id="一行代码实现FTP服务器"><a href="#一行代码实现FTP服务器" class="headerlink" title="一行代码实现FTP服务器"></a>一行代码实现FTP服务器</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">python -m pyftpdlib</span><br></pre></td></tr></table></figure>
<p>建议的关闭防火墙命令是<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">iptables -P INPUT ACCEPT</span><br><span class="line">iptables -P FORWARD ACCEPT</span><br><span class="line">iptables -P OUTPUT ACCEPT</span><br><span class="line">iptables -F</span><br></pre></td></tr></table></figure></p>
<h1 id="Centos-7-修改计算机时区-时间"><a href="#Centos-7-修改计算机时区-时间" class="headerlink" title="Centos 7 修改计算机时区 时间"></a>Centos 7 修改计算机时区 时间</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">timedatectl set-timezone Asia/Shanghai</span><br><span class="line">hwclock --set --date=&quot;6/27/17 14:14&quot;</span><br><span class="line">hwclock --hctosys</span><br></pre></td></tr></table></figure>
<h1 id="查看系统时间方面的各种状态"><a href="#查看系统时间方面的各种状态" class="headerlink" title="查看系统时间方面的各种状态"></a>查看系统时间方面的各种状态</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">timedatectl</span><br></pre></td></tr></table></figure>
<h1 id="获取ifconfig输出中的IP地址"><a href="#获取ifconfig输出中的IP地址" class="headerlink" title="获取ifconfig输出中的IP地址"></a>获取ifconfig输出中的IP地址</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ifconfig eth0 | awk &apos;/inet /&#123;print $2&#125;&apos;</span><br><span class="line">awk -F= &apos;/IPADDR/&#123;print $2&#125;&apos; /etc/sysconfig/network-scripts/ifcfg-eth*</span><br></pre></td></tr></table></figure>
<h1 id="带宽测速"><a href="#带宽测速" class="headerlink" title="带宽测速"></a>带宽测速</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">proxychains4 yum install python-pip –y</span><br><span class="line">proxychains4 pip install speedtest-cli</span><br><span class="line">yum install python-pip –y</span><br><span class="line">pip install speedtest-cli</span><br><span class="line">speedtest-cli --share</span><br></pre></td></tr></table></figure>
<h1 id="be-linux"><a href="#be-linux" class="headerlink" title="be linux"></a>be linux</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">find / -name beremote</span><br><span class="line">/home/zabbix/opt/VRTSralus/bin/beremote</span><br><span class="line">find: ‘/run/user/42/gvfs’: 权限不够</span><br><span class="line">/opt/VRTSralus/bin/beremote</span><br><span class="line">ls -al /run/user/42/gvfs</span><br><span class="line">ls: 无法访问/run/user/42/gvfs: 权限不够</span><br><span class="line">umount /run/user/42/gvfs</span><br><span class="line">find . -inum 554009 -exec rm&#123;&#125; \;</span><br><span class="line">rm -rf .gvfs</span><br><span class="line">find / -name beremote</span><br><span class="line">/home/zabbix/opt/VRTSralus/bin/beremote</span><br><span class="line">/opt/VRTSralus/bin/beremote</span><br></pre></td></tr></table></figure>
<h1 id="查看实时流量"><a href="#查看实时流量" class="headerlink" title="查看实时流量"></a>查看实时流量</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">watch ifconfig</span><br><span class="line">watch more /proc/net/dev</span><br></pre></td></tr></table></figure>
<h2 id="net-脚本"><a href="#net-脚本" class="headerlink" title="net 脚本"></a>net 脚本</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line">vim net.sh   </span><br><span class="line">#!/bin/bash</span><br><span class="line">ethn=$1</span><br><span class="line">while true</span><br><span class="line">do</span><br><span class="line">  RX_pre=$(cat /proc/net/dev | grep $ethn | sed &apos;s/:/ /g&apos; | awk &apos;&#123;print $2&#125;&apos;)</span><br><span class="line">  TX_pre=$(cat /proc/net/dev | grep $ethn | sed &apos;s/:/ /g&apos; | awk &apos;&#123;print $10&#125;&apos;)</span><br><span class="line">  sleep 1</span><br><span class="line">  RX_next=$(cat /proc/net/dev | grep $ethn | sed &apos;s/:/ /g&apos; | awk &apos;&#123;print $2&#125;&apos;)</span><br><span class="line">  TX_next=$(cat /proc/net/dev | grep $ethn | sed &apos;s/:/ /g&apos; | awk &apos;&#123;print $10&#125;&apos;)</span><br><span class="line">  clear</span><br><span class="line">  echo -e &quot;\t RX `date +%k:%M:%S` TX&quot;</span><br><span class="line">  RX=$(($&#123;RX_next&#125;-$&#123;RX_pre&#125;))</span><br><span class="line">  TX=$(($&#123;TX_next&#125;-$&#123;TX_pre&#125;))</span><br><span class="line">  if [[ $RX -lt 1024 ]];then</span><br><span class="line">    RX=&quot;$&#123;RX&#125;B/s&quot;</span><br><span class="line">  elif [[ $RX -gt 1048576 ]];then</span><br><span class="line">    RX=$(echo $RX | awk &apos;&#123;print $1/1048576 &quot;MB/s&quot;&#125;&apos;)</span><br><span class="line">  else</span><br><span class="line">    RX=$(echo $RX | awk &apos;&#123;print $1/1024 &quot;KB/s&quot;&#125;&apos;)</span><br><span class="line">  fi</span><br><span class="line">  if [[ $TX -lt 1024 ]];then</span><br><span class="line">    TX=&quot;$&#123;TX&#125;B/s&quot;</span><br><span class="line">  elif [[ $TX -gt 1048576 ]];then</span><br><span class="line">    TX=$(echo $TX | awk &apos;&#123;print $1/1048576 &quot;MB/s&quot;&#125;&apos;)</span><br><span class="line">  else</span><br><span class="line">    TX=$(echo $TX | awk &apos;&#123;print $1/1024 &quot;KB/s&quot;&#125;&apos;)</span><br><span class="line">  fi</span><br><span class="line">  echo -e &quot;$ethn \t $RX $TX &quot;</span><br><span class="line">done</span><br><span class="line">sh net.sh eth0</span><br></pre></td></tr></table></figure>
</section>
    <!-- Tags START -->
    
    <!-- Tags END -->
    <!-- NAV START -->
    
  <div class="nav-container">
    <!-- reverse left and right to put prev and next in a more logic postition -->
    
      <a class="nav-left" href="/blog/2018/09/04/Windows-常用命令/">
        <span class="nav-arrow">← </span>
        
          Windows-常用命令
        
      </a>
    
    
      <a class="nav-right" href="/blog/2018/09/05/Linux-快捷键/">
        
          Linux-快捷键
        
        <span class="nav-arrow"> →</span>
      </a>
    
  </div>

    <!-- NAV END -->
    
      <!-- No Comment -->
    
  </article>
  <!-- Article END -->
  <!-- Catalog START -->
  
    <aside class="catalog-container">
  <div class="toc-main">
    <strong class="toc-title">Catalog</strong>
    
      <ol class="toc-nav"><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#备份配置"><span class="toc-nav-text">备份配置</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#静态路由"><span class="toc-nav-text">静态路由</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#php-测试页"><span class="toc-nav-text">php 测试页</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#排除注释行"><span class="toc-nav-text">排除注释行</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#EmEditor-正则表达式去除空行"><span class="toc-nav-text">EmEditor 正则表达式去除空行</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#查看目录文件大小并按顺序排列取前十名"><span class="toc-nav-text">查看目录文件大小并按顺序排列取前十名</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#配置免密登录"><span class="toc-nav-text">配置免密登录</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#在bash中检查远程端口是否打开"><span class="toc-nav-text">在bash中检查远程端口是否打开:</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#Linux查看RAID"><span class="toc-nav-text">Linux查看RAID</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#Linux系统扫描硬盘坏块的方法"><span class="toc-nav-text">Linux系统扫描硬盘坏块的方法</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#Linux-查看硬件信息"><span class="toc-nav-text">Linux 查看硬件信息</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#RedHat-系列查看版本"><span class="toc-nav-text">RedHat 系列查看版本</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#Linux-生成随机密码"><span class="toc-nav-text">Linux 生成随机密码</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#Linux-命令——screen"><span class="toc-nav-text">Linux 命令——screen</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#Linux-增加回收站"><span class="toc-nav-text">Linux 增加回收站</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#Linux-安装开发工具包"><span class="toc-nav-text">Linux 安装开发工具包</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#一行代码实现FTP服务器"><span class="toc-nav-text">一行代码实现FTP服务器</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#Centos-7-修改计算机时区-时间"><span class="toc-nav-text">Centos 7 修改计算机时区 时间</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#查看系统时间方面的各种状态"><span class="toc-nav-text">查看系统时间方面的各种状态</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#获取ifconfig输出中的IP地址"><span class="toc-nav-text">获取ifconfig输出中的IP地址</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#带宽测速"><span class="toc-nav-text">带宽测速</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#be-linux"><span class="toc-nav-text">be linux</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#查看实时流量"><span class="toc-nav-text">查看实时流量</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#net-脚本"><span class="toc-nav-text">net 脚本</span></a></li></ol></li></ol>
    
  </div>
</aside>
  
  <!-- Catalog END -->
</main>

<script>
  (function () {
    var url = 'git@gitee.com:sanyuanempire/blog.git/2018/09/05/Linux-常用命令/';
    var banner = ''
    if (banner !== '' && banner !== 'undefined' && banner !== 'null') {
      $('#article-banner').css({
        'background-image': 'url(' + banner + ')'
      })
    } else {
      $('#article-banner').geopattern(url)
    }
    $('.header').removeClass('fixed-header')

     // error image
    $(".markdown-content img").on('error', function() {
      $(this).attr('src', 'http://file.muyutech.com/error-img.png')
      $(this).css({
        'cursor': 'default'
      })
    })

    // zoom image
    $(".markdown-content img").on('click', function() {
      var src = $(this).attr('src')
      if (src !== 'http://file.muyutech.com/error-img.png') {
        var imageW = $(this).width()
        var imageH = $(this).height()
        
        var zoom = ($(window).width() * 0.95 / imageW).toFixed(2)
        zoom = zoom < 1 ? 1 : zoom
        zoom = zoom > 2 ? 2 : zoom
        var transY = (($(window).height() - imageH) / 2).toFixed(2)

        $('body').append('<div class="image-view-wrap"><div class="image-view-inner"><img src="'+ src +'" /></div></div>')
        $('.image-view-wrap').addClass('wrap-active')
        $('.image-view-wrap img').css({
          'width': `${imageW}`,
          'transform': `translate3d(0, ${transY}px, 0) scale3d(${zoom}, ${zoom}, 1)`
        })
        $('html').css('overflow', 'hidden')

        $('.image-view-wrap').on('click', function() {
          $(this).remove()
          $('html').attr('style', '')
        })
      }
    })

    // qrcode
    var qr = new QRious({
      element: document.getElementById('share-qrcode'),
      value: document.location.href
    });

    // gitment
    var gitmentConfig = "";
    if (gitmentConfig !== 'undefined') {
      var gitment = new Gitment({
        id: "Linux-常用命令",
        owner: "",
        repo: "",
        oauth: {
          client_id: "",
          client_secret: ""
        },
        theme: {
          render(state, instance) {
            const container = document.createElement('div')
            container.lang = "en-US"
            container.className = 'gitment-container gitment-root-container'
            container.appendChild(instance.renderHeader(state, instance))
            container.appendChild(instance.renderEditor(state, instance))
            container.appendChild(instance.renderComments(state, instance))
            container.appendChild(instance.renderFooter(state, instance))
            return container;
          }
        }
      })
      gitment.render(document.getElementById('comments'))
    }
  })();
</script>

<script>
  var disqus_shortname = '';
  
  var disqus_url = 'git@gitee.com:sanyuanempire/blog.git/2018/09/05/Linux-常用命令/';
  
  (function(){
    var dsq = document.createElement('script');
    dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = '//go.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  })();
</script>

    <div class="scroll-top">
  <span class="arrow-icon"></span>
</div>
    <footer class="app-footer">
  <p class="copyright">
    &copy; 2018 | Proudly powered by <a href="https://sanyuanempire.gitee.io/blog" target="_blank">JinYan</a>
    <br>
    Theme by <a href="https://sanyuanempire.gitee.io/blog">JinYan</a>
  </p>
</footer>

<script>
  function async(u, c) {
    var d = document, t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
    s.parentNode.insertBefore(o, s);
  }
</script>
<script>
  async("//cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js", function(){
    FastClick.attach(document.body);
  })
</script>

<script>
  var hasLine = 'true';
  async("//cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js", function(){
    $('figure pre').each(function(i, block) {
      var figure = $(this).parents('figure');
      if (hasLine === 'false') {
        figure.find('.gutter').hide();
      }
      var lang = figure.attr('class').split(' ')[1] || 'code';
      var codeHtml = $(this).html();
      var codeTag = document.createElement('code');
      codeTag.className = lang;
      codeTag.innerHTML = codeHtml;
      $(this).attr('class', '').empty().html(codeTag);
      figure.attr('data-lang', lang.toUpperCase());
      hljs.highlightBlock(block);
    });
  })
</script>
<!-- Baidu Tongji -->

<script src="/blog/js/script.js"></script>

  </body>
</html>